<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>逻辑运算符</title>
</head>
<body>
    <button onclick="funLogic()">逻辑运算</button>
</body>
<script>
    function funLogic(){
        var a = 3 > 5
        var b = 6 < 9
        var c = a&&b   // && 与门 都真才是真
        console.log(c)
        var d = true
        var e = false
        var f = d||e
        console.log(f)  // || 或门 一真则为真
        console.log(!true)  // ! 非门 取反
        console.log(null??5) // ?? 判断对象是否为null或未定义
        console.log(1??5)
        var username
        username = username ?? "用户名为空"
        console.log(username)
    }
</script>
</html>